/**
 * elancom Corporation copy right 2012 - 2015  
 *   
 * $Header: https://192.168.1.224/svn/elancom/product/elancom-platform/trunk/src/main/java/com/elancom/framework/util/HtmlUtils.java 1034 2012-07-02 03:09:12Z lanzhouxue $
 * $Id: HtmlUtils.java 1034 2012-07-02 03:09:12Z lanzhouxue $
 * $Author: lanzhouxue $
 * $Date: 2012-07-02 11:09:12 +0800 (Mon, 02 Jul 2012) $
 * $Revision: 1034 $
 */
package com.elancom.framework.commons.util;

/**
 * HTML UTILS
 * 
 * @author Elan
 * @date 2011-1-7
 */
public class HtmlUtils {

	public static Object filter(String value, String[] bakWords) {
		if (value != null) {
			if (value instanceof Object) {
				String vs = value;
				if (bakWords != null) {
					for (final String ch : bakWords) {
						if (vs.indexOf(ch) != -1) {
							vs = vs.replaceAll(ch, "");
						}
					}
				}
				vs = vs.replaceAll("<", "&lt;");
				vs = vs.replaceAll(">", "&gt;");
				return vs;
			}
		}
		return value;
	}

	public static Object filterHtmlBakChars(Object value) {
		if (value != null) {
			if (value instanceof Object) {
				String vs = (String) value;
				vs = vs.replaceAll("<", "&lt;");
				vs = vs.replaceAll(">", "&gt;");
				return vs;
			}
		}
		return value;
	}
}
